/*
 * Copyright 2010 Matthew Werny & Burk Price.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * under the License.
 */

package net.iceflow.db.migration.experimental;

import java.util.List;

import net.iceflow.db.migration.experimental.model.DataStoreDetails;
import net.iceflow.db.migration.experimental.model.DataStoreQualifier;

/**
 * The general provider interface for migration operations
 * 
 * @version 1.0
 */
public interface OperationsFacade {
    /**
     * This is a bidirectional movement method of the proposed migration and shall be synchronous in its operation
     * 
     * @param level
     * @throws IllegalStateException
     * @since 1.0
     */
    //TODO: process failed.. change to more meaningful exception...
    public void migrateToLevel(Long level) throws IllegalStateException;
    
    /**
     * Prepare the data store for subsequent migrations
     * 
     * @throws Exception
     * @since 1.0
     */
    public void initializeDataStore() throws Exception;
    
    /**
     * Empty the data store of all migrations
     * 
     * @throws Exception
     * @since 1.0
     */
    public void purgeDataStore() throws Exception;

    /**
     * Retrieve a single specific {@link DataStoreDetails data store} information object
     * 
     * @param qualifier
     * @param value
     * @return DataStoreDetails
     * @since 1.0
     */
    public DataStoreDetails retrieveDataStoreBy(DataStoreQualifier qualifier, Object value);
    
    /**
     * Gets the list of {@link DataStoreDetails configured data store information objects}.
     * 
     * @return List<DataStoreDetails>
     * @since 1.0
     */
    public List<DataStoreDetails> listDataStores();
    
    /** 
     * May be called when the {@link OperationsFacade} is obtained or after the fact
     * 
     * @param config
     * @since 1.0
     */
    public void initializeConfigurationGraph(ConfigurationGraph config);

}
